<?php

class Flashgame_Widget_MenuGamesController extends Engine_Content_Widget_Abstract
{
   protected $_navigation;
  public function indexAction()
  {
        $this->view->navigation = $this->getNavigation();
  }
  public function getNavigation($active = false)
    {
        if( is_null($this->_navigation) )
        {
            $navigation = $this->_navigation = new Zend_Navigation();

            if(Engine_Api::_()->user()->getViewer()->getIdentity())
            {
                $navigation->addPage(array(
                'label' => Zend_Registry::get('Zend_Translate')->_('Browse Games'),
                'route' => 'flashgame_browse',
                'module' => 'flashgame',
                'controller' => 'index',
                'action' => 'index'
                ));
                $navigation->addPage(array(
                'label' => Zend_Registry::get('Zend_Translate')->_('My Games'),
                'route' => 'flashgame_manage',
                'module' => 'flashgame',
                'controller' => 'index',
                'action' => 'manage',
                'active' => $active
                ));
               
                $navigation->addPage(array(
                'label' => Zend_Registry::get('Zend_Translate')->_('Post a New Game'),
                'route' => 'flashgame_create',
                'module' => 'flashgame',
                'controller' => 'index',
                'action' => 'create'
                ));
                
                $navigation->addPage(array(
                'label' => Zend_Registry::get('Zend_Translate')->_('My Packages'),
                'route' => 'flashgame_userpackages',
                'module' => 'flashgame',
                'controller' => 'package',
                'action' => 'userpackages'
                ));
            }
        }
        return $this->_navigation;
    }

}